package com.three.usermanagement.controller;

import com.three.core.vo.R;
import com.three.usermanagement.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/userManagement/menu")
public class MenuController {
    @Autowired
    private MenuService menuService;
    @GetMapping("/selectAll")
       public R selectAll(){
        return menuService.selectAllMenus();
    }
    @GetMapping("/selectRoleMenus")
    public R selectRoleMenus(Integer roleId){
        return menuService.selectRoleMenus(roleId);
    }
    @PostMapping("/addMenuByRole")
    public R addMenuByRole(@RequestParam Integer roleId, @RequestBody List<Integer> menuIds) {
        return menuService.updateRoleMenus(roleId, menuIds);
    }
}
